package com.zhou.framework.mail;


import com.zhou.util.StringTool;
import com.zhou.message.dao.Attachment;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author lang.zhou
 * @date 2019/12/12
 */
@Data
public class MailMessage {
    private String title = "无标题";
    private String content;
    private String contentType = "text/html;charset=utf-8";
    /* 收件人*/
    private List<MailReceiver> receiverList = new ArrayList<>();
    /* 抄送人*/
    private List<MailReceiver> duplicateList = new ArrayList<>();
    private List<Attachment> attachmentList = new ArrayList<>();

    public MailMessage(String title, Object content) {
        this.title = title;
        this.content = StringTool.safeToString(content,"");
    }



    public void addReceiver(MailReceiver address){
        receiverList.add(address);
    }
    public void addReceiverList(List<MailReceiver> addressList){
        receiverList.addAll(addressList);
    }
    public void addDuplicate(MailReceiver address){
        duplicateList.add(address);
    }

    public void adddDuplicateList(List<MailReceiver> addressList){
        duplicateList.addAll(addressList);
    }
    public void addAttachement(Attachment attachment){
        attachmentList.add(attachment);
    }

}
